//////////////////////////////////////////////////
// Haiku Chat [UserID.h]
//     Encapsulates user data for any account,
//     Jabber or otherwise.
//////////////////////////////////////////////////

#ifndef USER_ID_H
#define USER_ID_H

#include <QString>

class UserID
{
	public:
	
		enum online_status  { UNKNOWN = 0, OFFLINE = 1, ONLINE = 2, CONF_STATUS = 3 };
		enum affiliation	{ OWNER, ADMIN, MODERATOR, MEMBER, GUEST };
		enum user_type      { INVALID, JABBER, CONFERENCE };

                                        UserID(QString username);
          	             		UserID(const UserID &copied_userid);
		virtual             	~UserID();

				UserID          &operator=(const UserID &rhs);

		const	user_type		UserType() const;
		const	online_status	OnlineStatus() const;

                const	QString		Handle() const;
                const	QString		FriendlyName() const;
                const	QString		SubscriptionStatus() const;
                const	QString		ExactOnlineStatus() const;
                const	QString		MoreExactOnlineStatus() const;


				bool			HaveSubscriptionTo() const;
				bool			IsUser() const;

                const	QString		JabberHandle() const;         // xxx@yyy
                const	QString		JabberCompleteHandle() const; // xxx@yyy/zzz
                const	QString		JabberUsername() const;       // xxx
                const	QString		JabberServer() const;         // yyy
                const	QString		JabberResource() const;       // zzz

				void			StripJabberResource();        // xxx@yyy/zzz -> xxx@yyy
                                QString		WhyNotValidJabberHandle();

				void            SetUsertype(user_type usertype);
				void            SetOnlineStatus(online_status status);
                                const QString            Autojoin() const;

				void            SetAutojoin(bool autojoin);
                                void            SetHandle(QString handle);
                                void            SetJabberServer(QString handle);
                                void            SetRoomNick(QString nick);
                                void            SetFriendlyName(QString friendly_name);
                                void            SetSubscriptionStatus(QString status);
                                void            SetExactOnlineStatus(QString exact_status);
                                void            SetMoreExactOnlineStatus(QString exact_status);

				void            _ProcessHandle();

				online_status   _status;
				user_type       _user_type;
				
                                QString		_handle;
                                QString		_friendly_name;
                                QString		_service;
                                QString		_ask;
                                QString		_exact_status;
                                QString		_more_exact_status;
                                QString		_subscription_status;
                                QString		_room_nick;

                                QString		_jabber_username;
                                QString		_jabber_server;
                                QString		_jabber_resource;
				bool	_autojoin;
};

#endif
